package cn.javazd;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class SwaggerConfig {

	@Bean
    public Docket baseDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
        		.groupName("基础管理") //分组名称
				.select()
                .apis(RequestHandlerSelectors.basePackage("cn.javazd.base"))
                .paths(PathSelectors.any())
				.build()
				.apiInfo(apiInfo());
    }

	
	@Bean
	public Docket systemDocket() {
		return new Docket(DocumentationType.SWAGGER_2)
				.groupName("系统管理")//分组名称
				.select()
                .apis(RequestHandlerSelectors.basePackage("cn.javazd.system"))
                .paths(PathSelectors.any())
				.build()
				.apiInfo(apiInfo());
	}
	
	
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("API")
                .description("API文档")
                .termsOfServiceUrl("")
                .version("1.0")
                .build();
    }
}
